package org.jeecg.modules.online.auth.service.p005a;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.lang.invoke.SerializedLambda;
import java.util.ArrayList;
import java.util.List;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.online.auth.entity.OnlAuthPage;
import org.jeecg.modules.online.auth.entity.OnlAuthRelation;
import org.jeecg.modules.online.auth.mapper.OnlAuthPageMapper;
import org.jeecg.modules.online.auth.mapper.OnlAuthRelationMapper;
import org.jeecg.modules.online.auth.p004b.AuthConstants;
import org.jeecg.modules.online.auth.service.IOnlAuthPageService;
import org.jeecg.modules.online.auth.vo.AuthColumnVO;
import org.jeecg.modules.online.auth.vo.AuthPageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("onlAuthPageServiceImpl")
/* renamed from: org.jeecg.modules.online.auth.service.a.b */
/* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/auth/service/a/b.class */
public class OnlAuthPageServiceImpl extends ServiceImpl<OnlAuthPageMapper, OnlAuthPage> implements IOnlAuthPageService {
    @Autowired
    private OnlAuthRelationMapper onlAuthRelationMapper;

    /* renamed from: a */
//    private static /* synthetic */ Object m506a(SerializedLambda serializedLambda) {
//        String implMethodName = serializedLambda.getImplMethodName();
//        boolean z = true;
//        switch (implMethodName.hashCode()) {
//            case -1527749671:
//                if (implMethodName.equals("getCgformId")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case -75622813:
//                if (implMethodName.equals("getCode")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case -75248891:
//                if (implMethodName.equals("getPage")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case -75106384:
//                if (implMethodName.equals("getType")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case 289685465:
//                if (implMethodName.equals("getAuthId")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case 803533544:
//                if (implMethodName.equals("getStatus")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case 1988403495:
//                if (implMethodName.equals("getControl")) {
//                    z = false;
//                    break;
//                }
//                break;
//        }
//        switch (z) {
//            case false:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//                    return (v0) -> {
//                        return v0.getControl();
//                    };
//                }
//                break;
//            case true:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//                    return (v0) -> {
//                        return v0.getType();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//                    return (v0) -> {
//                        return v0.getType();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//                    return (v0) -> {
//                        return v0.getType();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//                    return (v0) -> {
//                        return v0.getType();
//                    };
//                }
//                break;
//            case true:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//                    return (v0) -> {
//                        return v0.getPage();
//                    };
//                }
//                break;
//            case true:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformId();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformId();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformId();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformId();
//                    };
//                }
//                break;
//            case AuthConstants.f111o /* 4 */:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//                    return (v0) -> {
//                        return v0.getStatus();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
//                    return (v0) -> {
//                        return v0.getStatus();
//                    };
//                }
//                break;
//            case true:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCode();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCode();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCode();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthPage") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCode();
//                    };
//                }
//                break;
//            case true:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/auth/entity/OnlAuthRelation") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getAuthId();
//                    };
//                }
//                break;
//        }
//        throw new IllegalArgumentException("Invalid lambda deserialization");
//    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public void disableAuthColumn(AuthColumnVO authColumnVO) {
    	 LambdaUpdateWrapper var2 = new UpdateWrapper<OnlAuthPage>().lambda()
        		 .eq(OnlAuthPage::getCgformId, authColumnVO.getCgformId())
        		 .eq(OnlAuthPage::getCode, authColumnVO.getCode())
        		 .eq(OnlAuthPage::getType, 1).set(OnlAuthPage::getStatus, 0);
         this.update(var2);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    @Transactional
    public void enableAuthColumn(AuthColumnVO authColumnVO) {
        String cgformId = authColumnVO.getCgformId();
        String code = authColumnVO.getCode();
        LambdaQueryWrapper var4 = new LambdaQueryWrapper<OnlAuthPage>().eq(OnlAuthPage::getCgformId, cgformId).eq(OnlAuthPage::getCode, code).eq(OnlAuthPage::getType, 1);
        List list = this.list(var4);
        if (list != null && list.size() > 0) {
        	LambdaUpdateWrapper var6 = new UpdateWrapper<OnlAuthPage>().lambda()
        			.eq(OnlAuthPage::getCgformId, cgformId)
        			.eq(OnlAuthPage::getCode, code)
        			.eq(OnlAuthPage::getType, 1)
        			.set(OnlAuthPage::getStatus, 1);
            this.update(var6);
            return;
        }
        ArrayList arrayList = new ArrayList();
        arrayList.add(new OnlAuthPage(cgformId, code, 3, 5));
        arrayList.add(new OnlAuthPage(cgformId, code, 5, 5));
        arrayList.add(new OnlAuthPage(cgformId, code, 5, 3));
        saveBatch(arrayList);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    @Transactional
    public void updateAuthColumnBatch(List<AuthColumnVO> authColumnVOList) {
        for (AuthColumnVO authColumnVO : authColumnVOList) {
            if (authColumnVO.getStatus().intValue() == 1) {
                enableAuthColumn(authColumnVO);
            } else {
                disableAuthColumn(authColumnVO);
            }
        }
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    @Transactional
    public void switchAuthColumn(AuthColumnVO authColumnVO) {
        String cgformId = authColumnVO.getCgformId();
        String code = authColumnVO.getCode();
        int switchFlag = authColumnVO.getSwitchFlag();
        if (switchFlag == 1) {
            switchListShow(cgformId, code, authColumnVO.isListShow());
        } else if (switchFlag == 2) {
            switchFormShow(cgformId, code, authColumnVO.isFormShow());
        } else if (switchFlag == 3) {
            switchFormEditable(cgformId, code, authColumnVO.isFormEditable());
        } else if (switchFlag == 4) {
            switchFormEditable(cgformId, code, authColumnVO.isFormEditable());
            switchFormShow(cgformId, code, authColumnVO.isFormShow());
        }
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    @Transactional
    public void switchAuthColumnBatch(List<AuthColumnVO> authColumnVOList) {
        for (AuthColumnVO authColumnVO : authColumnVOList) {
            switchAuthColumn(authColumnVO);
        }
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    @Transactional
    public void switchFormShow(String cgformId, String code, boolean flag) {
        m507a(cgformId, code, 5, 5, flag);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    @Transactional
    public void switchFormEditable(String cgformId, String code, boolean flag) {
        m507a(cgformId, code, 3, 5, flag);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    @Transactional
    public void switchListShow(String cgformId, String code, boolean flag) {
        m507a(cgformId, code, 5, 3, flag);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<AuthPageVO> queryRoleAuthByFormId(String roleId, String cgformId, int type) {
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleAuthByFormId(roleId, cgformId, type);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<AuthPageVO> queryRoleDataAuth(String roleId, String cgformId) {
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleDataAuth(roleId, cgformId);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<AuthPageVO> queryAuthByFormId(String cgformId, int type) {
        if (type == 1) {
            return ((OnlAuthPageMapper) this.baseMapper).queryAuthColumnByFormId(cgformId);
        }
        return ((OnlAuthPageMapper) this.baseMapper).queryAuthButtonByFormId(cgformId);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<String> queryRoleNoAuthCode(String cgformId, Integer control, Integer page) {
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId(), cgformId, control, page, null);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<String> queryFormDisabledCode(String cgformId) {
        return queryRoleNoAuthCode(cgformId, 3, 5);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<String> queryHideCode(String userId, String cgformId, boolean isList) {
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, 5, Integer.valueOf(isList ? 3 : 5), null);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<String> queryListHideColumn(String userId, String cgformId) {
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, 5, 3, 1);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<String> queryFormHideColumn(String userId, String cgformId) {
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, 5, 5, 1);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<String> queryFormHideButton(String userId, String cgformId) {
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, 5, 5, 2);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<String> queryHideCode(String cgformId, boolean isList) {
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId(), cgformId, 5, Integer.valueOf(isList ? 3 : 5), null);
    }

    @Override // org.jeecg.modules.online.auth.service.IOnlAuthPageService
    public List<String> queryListHideButton(String userId, String cgformId) {
        if (userId == null) {
            userId = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
        }
        return ((OnlAuthPageMapper) this.baseMapper).queryRoleNoAuthCode(userId, cgformId, 5, 3, 2);
    }

    /* renamed from: a */
    private void m507a(String str, String str2, int i, int i2, boolean z) {
    	LambdaQueryWrapper query =new LambdaQueryWrapper<OnlAuthPage>()
    			.eq(OnlAuthPage::getCgformId, str)
    			.eq(OnlAuthPage::getCode, str2)
    			.eq(OnlAuthPage::getControl, i)
    			.eq(OnlAuthPage::getPage, i2)
    			.eq(OnlAuthPage::getType, 1);
        OnlAuthPage onlAuthPage = this.baseMapper.selectOne(query);
        if (z) {
            if (onlAuthPage == null) {
                OnlAuthPage onlAuthPage2 = new OnlAuthPage();
                onlAuthPage2.setCgformId(str);
                onlAuthPage2.setCode(str2);
                onlAuthPage2.setControl(Integer.valueOf(i));
                onlAuthPage2.setPage(Integer.valueOf(i2));
                onlAuthPage2.setType(1);
                onlAuthPage2.setStatus(1);
                ((OnlAuthPageMapper) this.baseMapper).insert(onlAuthPage2);
            } else if (onlAuthPage.getStatus().intValue() == 0) {
                onlAuthPage.setStatus(1);
                ((OnlAuthPageMapper) this.baseMapper).updateById(onlAuthPage);
            }
        } else if (!z && onlAuthPage != null) {
            String id = onlAuthPage.getId();
            ((OnlAuthPageMapper) this.baseMapper).deleteById(id);
            this.onlAuthRelationMapper.delete(new LambdaQueryWrapper<OnlAuthRelation>().eq(OnlAuthRelation::getAuthId, id));
        }
    }
}
